package ymr.gui;

import java.awt.GridLayout;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import ymr.game.Game;
import ymr.game.Player;

public class WaitingRoomWindow extends JFrame{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	JLabel curPlayerLabel = new JLabel();
	JPanel textPanel = new JPanel(new GridLayout(10,0));
	List<JLabel> nameLabels = new ArrayList<JLabel>();
	JLabel curWaitLbl = new JLabel();
	
	public WaitingRoomWindow(Player pl, Game gm){
		
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setSize(600,450);
		this.setTitle("Ooteruum");
		setVisible(true);
		curPlayerLabel.setText("Tere, " + pl.getName() + "!");
		curPlayerLabel.setHorizontalAlignment((int) JTextField.CENTER_ALIGNMENT);
		textPanel.add(curPlayerLabel);
		curWaitLbl.setText("Praegu ooteruumis:");
		curWaitLbl.setHorizontalAlignment((int) JTextField.CENTER_ALIGNMENT);

		textPanel.add(curPlayerLabel);
		textPanel.add(curWaitLbl);
		System.out.println(gm.getPlayersInGame().get(0).getName());
		for(int i = 0; i < gm.getPlayersInGame().size(); i++){
			nameLabels.add((new JLabel()));
			nameLabels.get(i).setText(gm.getPlayersInGame().get(i).getName());
			nameLabels.get(i).setHorizontalAlignment((int) JTextField.CENTER_ALIGNMENT);

			textPanel.add(nameLabels.get(i));
			addPlayingButton();
		}
		add(textPanel);
		

	}

	private void addPlayingButton() {
		// TODO Auto-generated method stub
		
	}

}
